package com.whu.zqm.service.impl;

import com.whu.zqm.domain.Suppliers;
import com.whu.zqm.dao.SuppliersDao;
import com.whu.zqm.service.ISuppliersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zqm
 * @since 2022-10-28
 */
@Service
public class SuppliersServiceImpl extends ServiceImpl<SuppliersDao, Suppliers> implements ISuppliersService {

    @Autowired
    private SuppliersDao sd;
    @Override
    public List<Suppliers> getAll() {
        return sd.selectList(null);
    }

    @Override
    public Suppliers addSupplier(Suppliers s) {
        sd.insert(s);
        return sd.selectById(s.getId());
    }

    @Override
    public Suppliers getSupplier(long id) {
        return sd.selectById(id);
    }

    @Override
    public void deleteSupplier(long id) {
        sd.deleteById(id);
    }

}
